* {
    padding: 0px;
    margin: 0px;
}

body {
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    background: linear-gradient(200deg, pink, deeppink);
}

.loading {
    width: 86px;
    height: 196px;
    border: 1px solid;
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    /* 溢出的沙子隐藏 */
    align-items: center;
    /* 沙漏倒装动画 */
    animation: rotating 2s linear infinite;
}

/* 流下的沙柱 */
.loading::after {
    content: '';
    width: 5px;
    height: 96px;
    background: pink;
    position: absolute;
    top: 20px;
    /* 沙柱动画 */
    animation: flow 2s linear infinite;
}

/* 沙漏两侧的容器 */
.top, .bottom {
    width: 70px;
    height: 70px;
    border-style: solid;
    border-color: #dcdcdc;
    border-width: 4px 4px 12px 12px;
    border-radius: 50% 100% 50% 30%;
    position: relative;
    overflow: hidden;
}

.top{
    transform: rotate(-45deg);
}

.bottom{
    transform: rotate(135deg);
}

/* 沙漏两侧的沙子 */
.top::before,
.bottom::before {
    content: '';
    position: absolute;
    background: pink;
    width: inherit;
    height: inherit;
    /* 沙漏两侧的沙子的动画设置 */
    animation: 2s linear infinite;
}

.top::before {
    border-radius: 0 100% 0 0;
    /* 落沙 */
    animation-name: drop-sand;
}

.bottom::before {
    border-radius: 0 0 0 30%;
    transform: translate(50px, -50px);
     /* 堆沙 */
    animation-name: fill-sand;
}

@keyframes drop-sand {
    to{
        transform: translate(-50px, 50px);
    }
}

@keyframes fill-sand {
    to{
        transform: translate(0, 0);
    }
}

@keyframes flow {
    10%,100%{
        transform: translateY(64px);
    }
}

@keyframes rotating {
    0%, 90%{
        transform: rotate(0deg);
    }
    100% {
        transform: rotate(180deg);
    }
}